<?php

if (!defined('PUBLIC_HTML'))
{
	exit;
}

$page_title = 'Add a new user';
$submit = (isset($_POST['submit'])) ? true : false;

if ($submit)
{
	$post = array();
	$post['level']	= (isset($_POST['level']))		? (int) $string->secure($_POST['level'], 'sql_single_field') : (int) 0;
	$post['name']	= (isset($_POST['username']))	? ((!empty($_POST['username']))	? (string) $string->secure($_POST['username'],	'sql_single_field') : '') 			: '';
	$post['pass']	= (isset($_POST['pass']))		? ((!empty($_POST['target']))	? (string) $string->secure($_POST['target'],	'password') 		: (string) $string->secure('appels', 'password')) : (string) $string->secure('appels', 'password');
	$post['email']	= (isset($_POST['email']))		? ((!empty($_POST['email']))	? (string) $string->secure($_POST['email'],		'sql_single_field') : 'undefined') 	: 'undefined';
	$post['active']	= (int) 1;
	$database->sqlInsert(TABLE_USERS, $post, 'usr_');
	//redirect('cms.php?p=users');
	exit;
}

?>